import { ecs } from 'db://app-game/libs/ecs/ECS';
import { Node } from 'cc';
import { TableStaticCreature } from '../../../../table/TableStaticCreature';

/** 静态生物组件 */
@ecs.register('StaticModel')
export class StaticModelComp extends ecs.Comp {
  table: TableStaticCreature = new TableStaticCreature();
  _id: number = -1;
  /** 地图编号 */
  get id(): number {
    return this._id;
  }
  set id(value: number) {
    this._id = value;
    this.table.init(value);
  }

  /** 名称 */
  get name(): string {
    return this.table.name;
  }
  /** 描述 */
  get description(): string {
    return this.table.description;
  }
  /** 掉落物品 */
  get droppedItems(): any {
    return this.table.droppedItems;
  }
  /** 碰撞盒子 */
  get collisionBox(): any {
    return this.table.collisionBox;
  }
  /** 精灵图 */
  get spriteFrame(): string {
    return this.table.spriteFrame;
  }
  /** 精灵图阴影 */
  get shadowSpriteFrame(): string {
    return this.table.shadowSpriteFrame;
  }

  /** 透明状态 */
  transparentState = false;
  reset(entity: ecs.Entity): void {
    this._id = -1;
    this.transparentState = false;
  }
}
